<template>
	<view>
		<view class="header">
			<view class="top_bg">
				<image src="../../static/image/top_bg.png" mode=""></image>
			</view>

			<view class="hos_selecter">
				<view class="selected">
					<text class="tit">就诊医院：</text>
					<text class="sel_text">全部</text>
				</view>

				<view class="more">
					<image src="../../static/icon/more.png" mode=""></image>
				</view>
			</view>
		</view>
		
		<view class="scan">
			<view class="scan_btn">
				<image src="../../static/icon/tiaoxingma@2x.png" mode=""></image>
				<text>扫码获取数字影像报告</text>
			</view>
		</view>

		<view id="main">
			<view class="new_user_guide" v-if="user.status === 0">
				<view class="doctor">
					<image src="../../static/image/doctor.png" mode=""></image>
				</view>
				
				<view class="guide">
					<text class="tit">初次登录请您</text>
					<view class="list">
						<view class="item curr">
							<image class="icon" src="../../static/icon/listi@2x.png" mode=""></image>
							<text>绑定就诊人员</text>
						</view>
						<view class="item"><text>接收报告通知</text></view>
						<view class="item"><text>获取历史影像</text></view>
						<view class="item"><text>……</text></view>
					</view>
				</view>
			</view>

			<v-cord title="我的就诊人" class="patient">
				<view class="list">
					<view class="item" v-for="item in patients" :key="item.id">
						<view class="main">
							<view class="left">
								<view class="identity">
									<text class="name">{{ item.name }}</text>
									<text>（{{ item.identity_code }})</text>
								</view>
								
								<view>
									<text>{{ item.hospital }}</text>
								</view>
								
								<view>
									<text>就诊卡号：{{ item.cord_code }}</text>
								</view>
							</view>
							
							<view class="line"></view>
							
							<view class="right">
								<u-button :custom-style="changeCordBtnStyle" size="medium" shape="circle" plain>切换就诊号</u-button>
							</view>
						</view>

						<view class="footer">
							<text>检查报告查询 >></text>
						</view>
					</view>
				</view>
			</v-cord>
		</view>
	</view>
</template>

<script>
import { mapState } from 'vuex'

const changeCordBtnStyle = {
	color: '#0FDA9B',
	padding: '0 35rpx'
}

export default {
	components: {
	},
	data() {
		return {
			patients: [],
			changeCordBtnStyle
		}
	},

	computed: {
		...mapState([
			"user"
		])
	},
	
	onShow() {
		this.getPatients()
	},
	
	methods: {
		getPatients() {
			this.$axios.get('/api/patients')
				.then((res) => {
					this.patients = res.data.data
				})
		}
	}
}
</script>

<style lang="scss" scoped>
.header {
	height: 257rpx;
}
.top_bg {
	height: 257rpx;
	width: 100%;
	position: absolute;
	z-index: 0;

	image {
		object-fit: cover;
		height: 257rpx;
		width: 100%;
	}
}

.hos_selecter {
	position: relative;
	z-index: 1;
	top: 30rpx;
	background-color: #fff;
	height: 60rpx;
	line-height: 60rpx;
	padding: 0 29rpx;
	margin: 0 30rpx;
	font-size: 24rpx;
	border-radius: 8rpx;
	display: flex;
	
	.selected {
		flex-grow: 1;
	}
	
	.tit {
		color: #0363CA;
	}
	
	.sel_text {
		color: #0D0D0D;
	}
	
	.more image {
		width: 10rpx;
		height: 20rpx;
	}
}

#main {
	margin: 20rpx 0;
}

.scan {
	background: #fff;
	padding: 20rpx 30rpx;

	.scan_btn {
		display: flex;
		justify-content: center;
		align-items: center;
		height: 76rpx;
		border: 1px solid #0FDA9B;
		border-radius: 38rpx;
		font-size: 32rpx;
		color: #0FDA9B;
		
		image {
			width: 50rpx;
			height: 37rpx;
			margin-right: 13rpx;
		}
	}
}

.new_user_guide {
	display: flex;
	justify-content: center;
	align-items: center;
	height: 482rpx;
	
	.doctor {
		image {
			width: 145rpx;
			height: 272rpx;
		}
	}
	
	.guide {
		text-align: right;
		margin-left: 50rpx;

		.tit {
			font-size: 32rpx;
			color: #333;
			font-weight: bold;
			line-height: 50rpx;
		}
		
		.item {
			font-size: 28rpx;
			line-height: 45rpx;
			color: #999;
		}
		
		.icon {
			width: 18rpx;
			height: 18rpx;
			margin-right: 5rpx;
		}
	
		.curr {
			color: #0077F9;
		}
	}
}

.patient {
	margin-top: 24rpx;

	.list {
		.item {
			padding: 30rpx 35rpx 0 35rpx;
			box-shadow: 0 0 6rpx 3rpx rgba(125, 125, 125, 0.1);
			margin-bottom: 24rpx;
			border-radius: 8rpx;
			
			.main {
				display: flex;
				align-items: center;
				font-size: 26rpx;
				color: #666;
				line-height: 45rpx;
				
				.identity {
					color: #333;
					
					.name {
						font-weight: bold;
						font-size: 28rpx;
					}
				}
				
				.left {
					flex-grow: 1;
					padding-right: 30rpx;
				}
				
				.right {
					padding: 0 0 0 30rpx;

					.change_cord_btn {
						button {
							color: #0FDA9B;
							border-color: #0FDA9B;
						}
					}
				}
				
				.line {
					height: 56rpx;
					border-left: 1px dashed #b2b2b2;
				}
			}

			.footer {
				padding: 30rpx 0;
				text-align: center;
				border-top: 1px solid #f1f1f1;
				margin-top: 30rpx;
				font-size: 22rpx;
				color: #333;
			}
		}
	}
}
</style>